package com.ilovepostcard.controller;


import com.ilovepostcard.data.Postcard;

public class PostcardController {
	
	private static PostcardController mInstance;
	
	private Postcard currentPC;
	
	public static PostcardController getInstance()
	{
		if(mInstance == null)
			mInstance = new PostcardController();
		
		return mInstance;
	}

	public void createNewPostcard(Postcard pc)
	{
		if(currentPC != null)
			releaseCurrentPostCard();
		
		currentPC = pc;
		OffLineManager.getInstance().createBackupPC();
	}
	
	public Postcard getCurrentPostCard()
	{
		return currentPC;
	}
	
	public void releaseCurrentPostCard()
	{
		if(currentPC!= null)
		{
//			if(currentPC.image!= null && !currentPC.image.isRecycled())
//			{
//				currentPC.image.recycle();
//				currentPC.image = null;
//			}
			currentPC = null;
		}
	}
		
}
